home *** CD-ROM | disk | FTP | other *** search
/ PCGUIA 127 / PC Guia 127.iso / Software / Produtividade / OpenOffice.org 2.0.1 / openofficeorg2.cab / measure_conversion.xsl < prev    next >
Extensible Markup Language  |  2005-09-10  |  20KB  |  396 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3.  
  4.     OpenOffice.org - a multi-platform office productivity suite
  5.  
  6.     $RCSfile: measure_conversion.xsl,v $
  7.  
  8.     $Revision: 1.7 $
  9.  
  10.     last change: $Author: rt $ $Date: 2005/09/08 22:00:38 $
  11.  
  12.     The Contents of this file are made available subject to
  13.     the terms of GNU Lesser General Public License Version 2.1.
  14.  
  15.  
  16.       GNU Lesser General Public License Version 2.1
  17.       =============================================
  18.       Copyright 2005 by Sun Microsystems, Inc.
  19.       901 San Antonio Road, Palo Alto, CA 94303, USA
  20.  
  21.       This library is free software; you can redistribute it and/or
  22.       modify it under the terms of the GNU Lesser General Public
  23.       License version 2.1, as published by the Free Software Foundation.
  24.  
  25.       This library is distributed in the hope that it will be useful,
  26.       but WITHOUT ANY WARRANTY; without even the implied warranty of
  27.       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  28.       Lesser General Public License for more details.
  29.  
  30.       You should have received a copy of the GNU Lesser General Public
  31.       License along with this library; if not, write to the Free Software
  32.       Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  33.       MA  02111-1307  USA
  34.  
  35. -->
  36. <!--
  37.     For further documentation and updates visit http://xml.openoffice.org/sx2ml
  38. -->
  39. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  40.     <!-- DPI (dots per inch) the standard resolution of given pictures (necessary for the conversion of 'cm' into 'pixel')
  41.          Although many pictures have a 96 dpi resolution, a higher resoltion give better results for common browsers -->
  42.     <xsl:param name="dpi" select="111"/>
  43.     <xsl:param name="centimeter-in-mm" select="10"/>
  44.     <xsl:param name="inch-in-mm" select="25.4"/>
  45.     <xsl:param name="didot-point-in-mm" select="0.376065"/>
  46.     <xsl:param name="pica-in-mm" select="4.2333333"/>
  47.     <xsl:param name="point-in-mm" select="0.3527778"/>
  48.     <xsl:param name="twip-in-mm" select="0.017636684"/>
  49.     <xsl:param name="pixel-in-mm" select="$inch-in-mm div $dpi"/>
  50.     <!-- ***** MEASUREMENT CONVERSIONS *****
  51.       PARAM 'value'
  52.         The measure to be converted.
  53.         The current measure is judged by a substring (e.g. 'mm', 'cm', 'in', 'pica'...)
  54.         directly added to the number.
  55.  
  56.       PARAM 'rounding-factor'
  57.         Is used for the rounding of decimal places.
  58.         The parameter number is the product of 1 and some '10', where
  59.         every zero represents a decimal place.
  60.  
  61.         For example, providing as parameter:
  62.             <xsl:param name="rounding-factor" select="10000" />
  63.         Gives by default four decimal places.
  64.  
  65.         To round two decimal places, basically the following is done:
  66.             <xsl:value-of select="round(100 * value) div 100"/>
  67.  
  68.       RETURN    The converted number, by default rounded to four decimal places.
  69.                 In case the input measure could not be matched the same value is
  70.                 returned and a warning message is written out.
  71.  
  72.  
  73.  
  74.      MEASURE LIST:
  75.      * 1 milimeter (mm), the basic measure
  76.  
  77.      * 1 centimeter (cm) = 10 mm
  78.  
  79.      * 1 inch (in) = 25.4 mm
  80.         While the English have already seen the light (read: the metric system), the US
  81.         remains loyal to this medieval system.
  82.  
  83.      * 1 point (pt) = 0.35277777.. mm
  84.         Sometimes called PostScript point (ppt), as when Adobe created PostScript, they added their own system of points.
  85.         There are exactly 72 PostScript points in 1 inch.
  86.  
  87.      * 1 twip = twentieth of a (PostScript) point
  88.         A twip (twentieth of a point) is a 1/20th of a PostScript point, a traditional measure in printing.
  89.  
  90.      * 1 didot point (dpt) = 0.376065 mm
  91.         Didot point after the French typographer Firmin Didot (1764-1836).
  92.  
  93.         More details under
  94.         http://www.unc.edu/~rowlett/units/dictP.html:
  95.         "A unit of length used by typographers and printers. When printing was done
  96.         from hand-set metal type, one point represented the smallest element of type
  97.         that could be handled, roughly 1/64 inch. Eventually, the point was standardized
  98.         in Britain and America as exactly 1/72.27 = 0.013 837 inch, which is
  99.         about 0.35 mm (351.46 micrometers). In continental Europe, typographers
  100.         traditionally used a slightly larger point of 0.014 83 inch (about
  101.         1/72 pouce, 0.377 mm, or roughly 1/67 English inch), called a Didot point
  102.         after the French typographer Firmin Didot (1764-1836). In the U.S.,
  103.         Adobe software defines the point to be exactly 1/72 inch (0.013 888 9 inch
  104.         or 0.352 777 8 millimeters) and TeX software uses a slightly smaller point
  105.         of 0.351 459 8035 mm. The German standards agency DIN has proposed that
  106.         all these units be replaced by multiples of 0.25 millimeters (1/101.6 inch).
  107.  
  108.      * 1 pica = 4.233333 mm
  109.         1/6 inch or 12 points
  110.  
  111.      * 1 pixel (px) = 0.26458333.. mm   (relative to 'DPI', here: 96 dpi)
  112.         Most pictures have the 96 dpi resolution, but the dpi variable may vary by stylesheet parameter
  113.  
  114.  
  115.     -->
  116.     <!-- changing measure to mm -->
  117.     <xsl:template name="convert2mm">
  118.         <xsl:param name="value"/>
  119.         <xsl:param name="rounding-factor" select="10000"/>
  120.         <xsl:choose>
  121.             <xsl:when test="contains($value, 'mm')">
  122.                 <xsl:value-of select="substring-before($value, 'mm')"/>
  123.             </xsl:when>
  124.             <xsl:when test="contains($value, 'cm')">
  125.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm' ) * $centimeter-in-mm)) div $rounding-factor"/>
  126.             </xsl:when>
  127.             <xsl:when test="contains($value, 'in')">
  128.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in' ) * $inch-in-mm)) div $rounding-factor"/>
  129.             </xsl:when>
  130.             <xsl:when test="contains($value, 'pt')">
  131.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') * $point-in-mm)) div $rounding-factor"/>
  132.             </xsl:when>
  133.             <xsl:when test="contains($value, 'twip')">
  134.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') * $twip-in-mm)) div $rounding-factor"/>
  135.             </xsl:when>
  136.             <xsl:when test="contains($value, 'dpt')">
  137.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') * $didot-point-in-mm)) div $rounding-factor"/>
  138.             </xsl:when>
  139.             <xsl:when test="contains($value, 'pica')">
  140.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') * $pica-in-mm)) div $rounding-factor"/>
  141.             </xsl:when>
  142.             <xsl:when test="contains($value, 'px')">
  143.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') * $pixel-in-mm)) div $rounding-factor"/>
  144.             </xsl:when>
  145.             <xsl:otherwise>
  146.                 <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'mm'!</xsl:message>
  147.                 <xsl:value-of select="$value"/>
  148.             </xsl:otherwise>
  149.         </xsl:choose>
  150.     </xsl:template>
  151.     <!-- changing measure to cm -->
  152.     <xsl:template name="convert2cm">
  153.         <xsl:param name="value"/>
  154.         <xsl:param name="rounding-factor" select="10000"/>
  155.         <xsl:choose>
  156.             <xsl:when test="contains($value, 'mm')">
  157.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $centimeter-in-mm)) div $rounding-factor"/>
  158.             </xsl:when>
  159.             <xsl:when test="contains($value, 'cm')">
  160.                 <xsl:value-of select="substring-before($value, 'cm')"/>
  161.             </xsl:when>
  162.             <xsl:when test="contains($value, 'in')">
  163.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $centimeter-in-mm * $inch-in-mm)) div $rounding-factor"/>
  164.             </xsl:when>
  165.             <xsl:when test="contains($value, 'pt')">
  166.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $centimeter-in-mm * $point-in-mm)) div $rounding-factor"/>
  167.             </xsl:when>
  168.             <xsl:when test="contains($value, 'dpt')">
  169.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $centimeter-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
  170.             </xsl:when>
  171.             <xsl:when test="contains($value, 'pica')">
  172.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $centimeter-in-mm * $pica-in-mm)) div $rounding-factor"/>
  173.             </xsl:when>
  174.             <xsl:when test="contains($value, 'twip')">
  175.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $centimeter-in-mm * $twip-in-mm)) div $rounding-factor"/>
  176.             </xsl:when>
  177.             <xsl:when test="contains($value, 'px')">
  178.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $centimeter-in-mm * $pixel-in-mm)) div $rounding-factor"/>
  179.             </xsl:when>
  180.             <xsl:otherwise>
  181.                 <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'cm'!</xsl:message>
  182.                 <xsl:value-of select="$value"/>
  183.             </xsl:otherwise>
  184.         </xsl:choose>
  185.     </xsl:template>
  186.     <!-- changing measure to inch (cp. section comment) -->
  187.     <xsl:template name="convert2in">
  188.         <xsl:param name="value"/>
  189.         <xsl:param name="rounding-factor" select="10000"/>
  190.         <xsl:choose>
  191.             <xsl:when test="contains($value, 'mm')">
  192.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $inch-in-mm)) div $rounding-factor"/>
  193.             </xsl:when>
  194.             <xsl:when test="contains($value, 'cm')">
  195.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $inch-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
  196.             </xsl:when>
  197.             <xsl:when test="contains($value, 'in')">
  198.                 <xsl:value-of select="substring-before($value, 'in')"/>
  199.             </xsl:when>
  200.             <xsl:when test="contains($value, 'pt')">
  201.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $inch-in-mm * $point-in-mm)) div $rounding-factor"/>
  202.             </xsl:when>
  203.             <xsl:when test="contains($value, 'dpt')">
  204.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $inch-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
  205.             </xsl:when>
  206.             <xsl:when test="contains($value, 'pica')">
  207.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $inch-in-mm * $pica-in-mm)) div $rounding-factor"/>
  208.             </xsl:when>
  209.             <xsl:when test="contains($value, 'twip')">
  210.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $inch-in-mm * $twip-in-mm)) div $rounding-factor"/>
  211.             </xsl:when>
  212.             <xsl:when test="contains($value, 'px')">
  213.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $inch-in-mm * $pixel-in-mm)) div $rounding-factor"/>
  214.             </xsl:when>
  215.             <xsl:otherwise>
  216.                 <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'in'!</xsl:message>
  217.                 <xsl:value-of select="$value"/>
  218.             </xsl:otherwise>
  219.         </xsl:choose>
  220.     </xsl:template>
  221.     <!-- changing measure to dpt (cp. section comment) -->
  222.     <xsl:template name="convert2dpt">
  223.         <xsl:param name="value"/>
  224.         <xsl:param name="rounding-factor" select="10000"/>
  225.         <xsl:choose>
  226.             <xsl:when test="contains($value, 'mm')">
  227.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $didot-point-in-mm)) div $rounding-factor"/>
  228.             </xsl:when>
  229.             <xsl:when test="contains($value, 'cm')">
  230.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $didot-point-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
  231.             </xsl:when>
  232.             <xsl:when test="contains($value, 'in')">
  233.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $didot-point-in-mm * $inch-in-mm)) div $rounding-factor"/>
  234.             </xsl:when>
  235.             <xsl:when test="contains($value, 'pt')">
  236.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $didot-point-in-mm * $point-in-mm)) div $rounding-factor"/>
  237.             </xsl:when>
  238.             <xsl:when test="contains($value, 'dpt')">
  239.                 <xsl:value-of select="substring-before($value, 'dpt')"/>
  240.             </xsl:when>
  241.             <xsl:when test="contains($value, 'pica')">
  242.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $didot-point-in-mm * $pica-in-mm)) div $rounding-factor"/>
  243.             </xsl:when>
  244.             <xsl:when test="contains($value, 'twip')">
  245.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $didot-point-in-mm * $twip-in-mm)) div $rounding-factor"/>
  246.             </xsl:when>
  247.             <xsl:when test="contains($value, 'px')">
  248.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $didot-point-in-mm * $pixel-in-mm)) div $rounding-factor"/>
  249.             </xsl:when>
  250.             <xsl:otherwise>
  251.                 <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'dpt'!</xsl:message>
  252.                 <xsl:value-of select="$value"/>
  253.             </xsl:otherwise>
  254.         </xsl:choose>
  255.     </xsl:template>
  256.     <!-- changing measure to pica (cp. section comment) -->
  257.     <xsl:template name="convert2pica">
  258.         <xsl:param name="value"/>
  259.         <xsl:param name="rounding-factor" select="10000"/>
  260.         <xsl:choose>
  261.             <xsl:when test="contains($value, 'mm')">
  262.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $pica-in-mm)) div $rounding-factor"/>
  263.             </xsl:when>
  264.             <xsl:when test="contains($value, 'cm')">
  265.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $pica-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
  266.             </xsl:when>
  267.             <xsl:when test="contains($value, 'in')">
  268.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $pica-in-mm * $inch-in-mm)) div $rounding-factor"/>
  269.             </xsl:when>
  270.             <xsl:when test="contains($value, 'pt')">
  271.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $pica-in-mm * $point-in-mm)) div $rounding-factor"/>
  272.             </xsl:when>
  273.             <xsl:when test="contains($value, 'dpt')">
  274.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $pica-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
  275.             </xsl:when>
  276.             <xsl:when test="contains($value, 'pica')">
  277.                 <xsl:value-of select="substring-before($value, 'pica')"/>
  278.             </xsl:when>
  279.             <xsl:when test="contains($value, 'twip')">
  280.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $pica-in-mm * $twip-in-mm)) div $rounding-factor"/>
  281.             </xsl:when>
  282.             <xsl:when test="contains($value, 'px')">
  283.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $pica-in-mm * $pixel-in-mm)) div $rounding-factor"/>
  284.             </xsl:when>
  285.             <xsl:otherwise>
  286.                 <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'pica'!</xsl:message>
  287.                 <xsl:value-of select="$value"/>
  288.             </xsl:otherwise>
  289.         </xsl:choose>
  290.     </xsl:template>
  291.     <!-- changing measure to pt (cp. section comment) -->
  292.     <xsl:template name="convert2pt">
  293.         <xsl:param name="value"/>
  294.         <xsl:param name="rounding-factor" select="10000"/>
  295.         <xsl:choose>
  296.             <xsl:when test="contains($value, 'mm')">
  297.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $point-in-mm)) div $rounding-factor"/>
  298.             </xsl:when>
  299.             <xsl:when test="contains($value, 'cm')">
  300.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $point-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
  301.             </xsl:when>
  302.             <xsl:when test="contains($value, 'in')">
  303.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $point-in-mm * $inch-in-mm)) div $rounding-factor"/>
  304.             </xsl:when>
  305.             <xsl:when test="contains($value, 'pt')">
  306.                 <xsl:value-of select="substring-before($value, 'pt')"/>
  307.             </xsl:when>
  308.             <xsl:when test="contains($value, 'dpt')">
  309.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $point-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
  310.             </xsl:when>
  311.             <xsl:when test="contains($value, 'pica')">
  312.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $point-in-mm * $pica-in-mm)) div $rounding-factor"/>
  313.             </xsl:when>
  314.             <xsl:when test="contains($value, 'twip')">
  315.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $point-in-mm * $twip-in-mm)) div $rounding-factor"/>
  316.             </xsl:when>
  317.             <xsl:when test="contains($value, 'px')">
  318.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $point-in-mm * $pixel-in-mm)) div $rounding-factor"/>
  319.             </xsl:when>
  320.             <xsl:otherwise>
  321.                 <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'pt'!</xsl:message>
  322.                 <xsl:value-of select="$value"/>
  323.             </xsl:otherwise>
  324.         </xsl:choose>
  325.     </xsl:template>
  326.     <!-- changing measure to pt (cp. section comment) -->
  327.     <xsl:template name="convert2twip">
  328.         <xsl:param name="value"/>
  329.         <xsl:param name="rounding-factor" select="10000"/>
  330.         <xsl:choose>
  331.             <xsl:when test="contains($value, 'mm')">
  332.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $twip-in-mm)) div $rounding-factor"/>
  333.             </xsl:when>
  334.             <xsl:when test="contains($value, 'cm')">
  335.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $twip-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
  336.             </xsl:when>
  337.             <xsl:when test="contains($value, 'in')">
  338.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $twip-in-mm * $inch-in-mm)) div $rounding-factor"/>
  339.             </xsl:when>
  340.             <xsl:when test="contains($value, 'pt')">
  341.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $twip-in-mm * $point-in-mm)) div $rounding-factor"/>
  342.             </xsl:when>
  343.             <xsl:when test="contains($value, 'dpt')">
  344.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $twip-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
  345.             </xsl:when>
  346.             <xsl:when test="contains($value, 'pica')">
  347.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $twip-in-mm * $pica-in-mm)) div $rounding-factor"/>
  348.             </xsl:when>
  349.             <xsl:when test="contains($value, 'twip')">
  350.                 <xsl:value-of select="substring-before($value, 'twip')"/>
  351.             </xsl:when>
  352.             <xsl:when test="contains($value, 'px')">
  353.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $twip-in-mm * $pixel-in-mm)) div $rounding-factor"/>
  354.             </xsl:when>
  355.             <xsl:otherwise>
  356.                 <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'twip'!</xsl:message>
  357.                 <xsl:value-of select="$value"/>
  358.             </xsl:otherwise>
  359.         </xsl:choose>
  360.     </xsl:template>
  361.     <!-- changing measure to pixel by via parameter provided dpi (dots per inch) standard factor (cp. section comment) -->
  362.     <xsl:template name="convert2px">
  363.         <xsl:param name="value"/>
  364.         <xsl:choose>
  365.             <xsl:when test="contains($value, 'mm')">
  366.                 <xsl:value-of select="round(number(substring-before($value, 'mm')) div $pixel-in-mm)"/>
  367.             </xsl:when>
  368.             <xsl:when test="contains($value, 'cm')">
  369.                 <xsl:value-of select="round(number(substring-before($value, 'cm')) div $pixel-in-mm * $centimeter-in-mm)"/>
  370.             </xsl:when>
  371.             <xsl:when test="contains($value, 'in')">
  372.                 <xsl:value-of select="round(number(substring-before($value, 'in')) div $pixel-in-mm * $inch-in-mm)"/>
  373.             </xsl:when>
  374.             <xsl:when test="contains($value, 'pt')">
  375.                 <xsl:value-of select="round(number(substring-before($value, 'pt')) div $pixel-in-mm * $point-in-mm)"/>
  376.             </xsl:when>
  377.             <xsl:when test="contains($value, 'dpt')">
  378.                 <xsl:value-of select="round(number(substring-before($value, 'dpt')) div $pixel-in-mm * $didot-point-in-mm)"/>
  379.             </xsl:when>
  380.             <xsl:when test="contains($value, 'pica')">
  381.                 <xsl:value-of select="round(number(substring-before($value, 'pica')) div $pixel-in-mm * $pica-in-mm)"/>
  382.             </xsl:when>
  383.             <xsl:when test="contains($value, 'twip')">
  384.                 <xsl:value-of select="round(number(substring-before($value, 'twip')) div $pixel-in-mm * $twip-in-mm)"/>
  385.             </xsl:when>
  386.             <xsl:when test="contains($value, 'px')">
  387.                 <xsl:value-of select="$value"/>
  388.             </xsl:when>
  389.             <xsl:otherwise>
  390.                 <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'px'!</xsl:message>
  391.                 <xsl:value-of select="$value"/>
  392.             </xsl:otherwise>
  393.         </xsl:choose>
  394.     </xsl:template>
  395. </xsl:stylesheet>
  396.